﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="add.aspx.cs" Inherits="SiteInfo_Default2" %>
<%@ Register src="SiteTypeSelect.ascx" tagname="SiteTypeSelect" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
     <link href="../css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <link href="../css/jquery-ui-1.7.3.custom.css" rel="Stylesheet" type="text/css" />
     <script type="text/javascript" src="../edit/jquery/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../edit/xheditor-zh-cn.src.js"></script>
    <script src="../js/jquery.autocomplete.js"  type="text/javascript" language="javascript" ></script>
    <script src="../js/StockSearchData.js" language="javascript" type="text/javascript"></script>
    <script src="../js/jquery-ui-1.7.3.custom.min.js" language="javascript" type="text/javascript"></script>
    <script type="text/javascript" defer="defer" src="../My97DatePicker/WdatePicker.js"></script>

    <script type="text/javascript" language="javascript">
        var selectValue = new Array();
        $(document).ready(function () {
            $("#btnBack").click(function () {
                document.location = "default.aspx";
            })
        });
        $(document).ready(function () {
            $('#dialog').dialog({
                autoOpen: false,
                modal: true,
                width: 750,
                buttons: {
                    "取消": function () {
                        var chks = $("#DataList1 input[type=checkbox]");
                        for (var i = 0; i < chks.length; i++) {
                            chks[i].checked = false;
                            for (var j = 0; j < selectValue.length; j++) {
                                if (chks[i].value == selectValue[j]) {
                                    chks[i].checked = true;
                                }
                            }
                        }
              
                        $(this).dialog("close");
                      //  
                   
                    },
                    "确定": function () {
                        var chks = $("#DataList1 input[type=checkbox]");
                        //$("#lblSelectType").html('');
                        var txt = '';
                        var val = "";
                        for (var i = 0; i < chks.length; i++) {
                            var chk = chks[i]
                            if (chk.checked) {
                                txt += $(chk).parent().children("label").html() + ",";
                                val += $(chk).val() + ",";
                            }
                        }
                        if (val.length > 0) {
                            val = val.substring(0, val.length - 1);
                            $("#hidSelectValue").val(val);
                        }
                        if (txt.length > 0) {
                            txt = txt.substring(0, txt.length - 1);
                        }
                        // $("#lblSelectType").html(txt);
                        document.getElementById("div1").style.display = "none"; 
                        $(this).dialog("close");
                        

                       
                    }
                }
            });
            $("#btnSelect").click(function () {
                var chks = $("#DataList1 input[type=checkbox]");

                var vals = $("#hidSelectValue").val().split(",");
                for (var i = 0; i < vals.length; i++) {
                    for (var j = 0; j < chks.length; j++) {
                        if (chks[j].value == vals[i]) {
                            chks[j].checked = true;
                        }
                    }
                }
                selectValue.length = 0;
                for (var j = 0; j < chks.length; j++) {
                    if (chks[j].checked) {
                        selectValue[selectValue.length] = $(chks[j]).val();
                    }
                }
                document.getElementById("div1").style.display = "block"; 
                $('#dialog').dialog('open');
            })
        })

    </script>
    <title></title>
</head>
<body>
    <div class="page_title">导航页面管理&nbsp; &gt; 添加网站信息</div>
    <form id="form1" runat="server">
    <asp:HiddenField ID="hidSelectValue" runat="server" />
    <div class="button_bar">
	<input type="button" class="common_button" id="btnBack" value="返回"/>
    <asp:Button ID="btnSave" CssClass="common_button" runat="server" Text="保存" 
            onclick="btnSave_Click" />
</div>
    <table class="query_form_table">
	<tr>
		<th>类型编号</th>
		<td><asp:TextBox ID="txtId" runat="server" ReadOnly="True" Visible="False" /> 
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ErrorMessage="*" ControlToValidate="txtId" Display="Dynamic" 
                ForeColor="Red" Visible="False"></asp:RequiredFieldValidator>
        </td>
		<th>网址</th>
		<td>
        <asp:TextBox ID="txtUrl" runat="server" Width="193px" /> 
			<%--<asp:DropDownList ID="ddlPid" runat="server">
            </asp:DropDownList>--%>

        </td>
	</tr>
    <tr>
		<th>导航名称</th>
		<td><asp:TextBox ID="txtName" runat="server" /> 
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ErrorMessage="*" ControlToValidate="txtName" Display="Dynamic" 
                ForeColor="Red"></asp:RequiredFieldValidator></td>
		<th>权重</th>
		<td>
			<asp:DropDownList ID="ddlWt" runat="server">
                <asp:ListItem Value="1">黑</asp:ListItem>
                <asp:ListItem Value="2">蓝</asp:ListItem>
                <asp:ListItem Value="3">红</asp:ListItem>
            </asp:DropDownList>

        </td>
	</tr>
	<tr>
		<th>图片地址</th>
		<td>
         
     <asp:FileUpload ID="FileUpload1" runat="server" />
            <asp:Button ID="btnPic" runat="server"
                Text="上传" onclick="btnPic_Click" Visible="False" />
        </td>
		<th><%--类型状态--%>所属导航分类</th>
		<td>
        <asp:Label ID="lblSelectType" runat="server" /> <input value="选择" id="btnSelect" type="button" class="common_button" />

        </td>
	</tr>	
	<tr>
		<th>备注</th>
		<td colspan="3"><asp:TextBox ID="txtMemo" TextMode="MultiLine" runat="server" 
                Height="52px" Width="582px" /></td>
	</tr>
	</table>

        <div id="dialog" title="提示消息" style="display:none;">
        <div id="div1" style="overflow-y:auto; height:350px; ">
        <p id="content" style="text-align: center">
            <asp:DataList ID="DataList1" runat="server" 
                onitemdatabound="DataList1_ItemDataBound" 
                RepeatDirection="Horizontal" RepeatColumns="1">
                <ItemTemplate>
                    <uc1:SiteTypeSelect ID="SiteTypeSelect1" runat="server" Pid='<%# Eval("stid") %>' />
                </ItemTemplate>
            </asp:DataList>
        </p>
        </div>
    </div>
    </form>
</body>
</html>

